<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Item Template Generator</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            margin: 0;
            padding: 20px;
            background-color: #1e1e1e;
            color: #ffffff;
        }

        .container {
            max-width: 600px;
            margin: 0 auto;
            background-color: #2c2c2c;
            padding: 20px;
            border-radius: 8px;
            box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
        }

        .header {
            display: flex;
            justify-content: space-between; /* 增加间距 */
            align-items: center;
            margin-bottom: 20px;
        }

        .header span {
            font-size: 1.5em;
            font-weight: bold;
            color: #ffffff;
        }

        .header input {
            width: 50px;
            padding: 8px;
            border: 1px solid #444444;
            border-radius: 4px;
            background-color: #333333;
            color: #ffffff;
            transition: border-color 0.3s;
        }

        .header input:focus {
            border-color: #4CAF50;
            outline: none;
        }

        .header button {
            background-color: #4CAF50;
            color: white;
            border: none;
            padding: 10px 20px;
            border-radius: 4px;
            cursor: pointer;
            transition: background-color 0.3s;
        }

        .header button:hover {
            background-color: #45a049;
        }
    </style>
    <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
</head>

<body>
    <div class="container">
        <div class="header">
            <span>生成物品模板</span>
            <input type="number" id="itemCount" value="1" min="1">
            <button id="generateButton">生成</button>
        </div>
    </div>
    <script>
        const vscode = acquireVsCodeApi();

        document.getElementById('generateButton').addEventListener('click', generateTemplates);

        function generateTemplates() {
            const count = parseInt(document.getElementById('itemCount').value, 10);

            if (isNaN(count) || count < 1) {
                alert('请输入有效的数字');
                return;
            }

            vscode.postMessage({ command: 'Create', data: count });
        }
    </script>
</body>

</html>